Add Support for Python 3#379
Merged
Merged
Conversation
There was a problem hiding this comment.
For safety, shouldn't the Python 2 version from __future__ import print_function?
- actually return from __next()__ - use isinstance instead == to determine object type - import print_function from __future__ for Python 2 - port assertItemsEqual() from Python2 to Python3 - actually run the YZ tests 😲
702cb3e to
5b006f7
Compare
There was a problem hiding this comment.
Not having this installed was my first roadblock, and there doesn't seem to be anything that requires it in the setup file, commands or version. Since this is only used to detect Python 2, can you change it to the simpler version like on line 20?
It'd be reasonable to include it as a dependency in the package, however, since it's used in so many places.
|
👍 533aea5 |
borshop
added a commit
that referenced
this pull request
Dec 9, 2014
Add Support for Python 3 Reviewed-by: seancribbs
Author
|
@borshop merge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a wide-sweeping change which allows the Python client to run on these versions:
The
sixmodule is critical in supporting both Python 2 and Python 3 and is used whenever appropriate.In other places conditions have been added with the
six.PY2andsix.PY3constants to run the appropriate code.Here are a few changes from Python 2 to 3 which were addressed:
printis now a functionbytes) instead of stringsdicts return iterators, not lists in iterable contextslongtype has been deprecated andintis now 64-bitnext()in the iterable interface is now__next()__ssllibrary is used instead ofPyOpenSSLto support HTTPssllibrary is not as mature as Python 3.4 so lacks a few features (like TLS 1.2)ssllibrary only allows certificate files, not bytes treams, to be added so theSecurityCredsclass does not support cached files like it does in Python 2test_six.pywas introduced to hand the renamesxrange()was retired sorange()was used in its steadriak_objectwere adjusted in Python 3 since strings need to be encoded before sent to the transport layeropeninterface changed slightlyNOTE: This PR is dependent upon
riak_pbbasho/riak_pb#104